Question: $f(x) = \begin{cases} \cos(x) & \text{for} ~~~~x\lt0 \\ 1-2x & \text{for} ~~~~ x \geq0\end{cases}$ Evaluate the definite integral. $\int^1_{-\frac{\pi}2}f(x)\,dx = $ Choose 1 answer: Choose 1 answer: (Choice A) A $-\dfrac1\pi+1$ (Choice B) B $-\dfrac1\pi$ (Choice C) C $-1$ (Choice D) D $1$
Splitting up the definite integral Since we're working with a piecewise function, we need to split the definite integral up into two pieces: $\phantom{=} \int^1_{-\frac{\pi}2}f(x)\,dx$ $= \int^0_{-\frac{\pi}2}f(x)\,dx + \int^1_{0}f(x)\,dx~~~~~~$ [Why did we split at 0?] $= \int^0_{-\frac{\pi}2}\cos(x)\,dx + \int^1_{0}(1-2x)\,dx ~~~~~~$ Evaluating each piece Next, let's evaluate each of these definite integrals one at a time. The first definite integral: $\begin{aligned} \int^0_{-\frac{\pi}2}\cos(x)\,dx~ &=\sin(x)\Bigg|^0_{{-\frac{\pi}2}} \\\\ &= \left[\sin( 0)\right] - \left[\sin\left( {-\dfrac\pi2}\right)\right] \\\\ &=[0] - [-1] \\\\ &= {1}\end{aligned}$ The second definite integral: $\begin{aligned} \int^1_{0}(1-2x)\,dx~ &=x-x^2\Bigg|^{1}_{{0}} \\\\ &= \left[(1)- ( 1)^2 \right] - \left[ ({0}) - ({0})^2 \right] \\\\ &= \left[0\right] -\left[0 \right] \\\\ &= {0}\end{aligned}$ Putting the pieces together Now let's add these two pieces together to find the answer: $\phantom{=} \int^0_{-\frac{\pi}2}\cos(x)\,dx + \int^1_{0}(1-2x)\,dx$ $ = {1} + {0}$ $ = 1$ The answer $\int^1_{-\frac{\pi}2}f(x)\,dx = 1$